home *** CD-ROM | disk | FTP | other *** search
- @echo off
- ! trashfile.bat Batch file to move a file to the system Trash
- !
- ! trashfile name
- !
- ! where 'name' is the file to be trashed. The name can be preceded by
- ! a path and a volume ID.
- !
- ! trashfile.bat calls extractName and uniqueName
- !
- ! Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
- !
-
- set trashfile_trash=1:\Trash
-
- ! ensure that the first parameter is there and that the second one is not
- set doserr=13
- if not "%2 " == " " goto ERR_LBL
- if "%1 " == " " goto ERR_LBL
-
- ! ensure that the requested file is there
- set doserr=27
- if not exist "%1" goto ERR_LBL
-
- ! make a file name to be used in the trash
- set doserr=0
- onerror ERR_LBL
- call extractName "%1" trashfile_name
- if not %doserr% == 0 goto ERR_LBL
- call uniqueName "%trashfile_trash%\%trashfile_name%" trashfile_name
- if not %doserr% == 0 goto ERR_LBL
-
- ! copy the file to the trash and remove the original
- copy "%1" "%trashfile_trash%\%trashfile_name%"
- del "%1"
- goto DONE_LBL
-
- :ERR_LBL
- show %doserr%
-
- :DONE_LBL
- ! remove the global variables
- set trashfile_name=
- set trashfile_trash=
-